//
//  LCFUIGlobel.m
//  lcf-newproject
//
//  Created by yangyang on 14-11-11.
//  Copyright (c) 2014年 yang. All rights reserved.
//

#import "LCFUIGlobel.h"

@implementation LCFUIGlobel
//创建UIButton的类方法
+(UIButton *)createButtonWithController:(id)viewController
                              WithFrame:(CGRect)frame
                              withTitle:(NSString *)title
                              imageName:(NSString *)imageName
                      selectedImageName:(NSString *)selectedImageName
                             withAction:(SEL)action{
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setFrame:frame];
    [btn setTitle:title forState:UIControlStateNormal];
    UIImage * normalImage = [UIImage imageNamed:imageName];
    UIImage * selectedImage = [UIImage imageNamed:selectedImageName];
    [btn setImage:normalImage forState:UIControlStateNormal];
    [btn setImage:selectedImage forState:UIControlStateSelected];
    [btn addTarget:viewController action:action forControlEvents:UIControlEventTouchUpInside];
    return btn;
}

//创建UIBarButtonItem的类方法
+(UIBarButtonItem *)createBarButtonItemWithController:(id)viewController
                                                Title:(NSString *)title
                                            withFrame:(CGRect)frame
                                  withNormalImageName:(NSString *)normalImageName
                                withSelectedImageName:(NSString *)selectedImageName
                                           withAction:(SEL)action
                                               isLeft:(BOOL)isLeft{
    UIButton * btn = [self createButtonWithController:viewController WithFrame:frame withTitle:title imageName:normalImageName selectedImageName:selectedImageName withAction:action];
    UIBarButtonItem * item = [[UIBarButtonItem alloc]initWithCustomView:btn];
    return item;
}

//创建UILabel的类方法
+(UILabel *)createLabelWithTitle:(NSString *)title
                       withFrame:(CGRect)frame
                    withFontType:(NSString *)fontType
                    withFontSize:(CGFloat)fontSize
                   withFontColor:(UIColor *)fontColor
                      isNeedBold:(BOOL)isbold{
    UILabel *label = [[UILabel alloc]initWithFrame:frame];
    label.text = title;
    label.font = [UIFont fontWithName:fontType size:fontSize];
    label.textColor = [UIColor whiteColor];
    if (isbold) {
        label.font = [UIFont boldSystemFontOfSize:fontSize];
    }
    return label;
}


@end
